package com.honhattan.web;

import java.io.Serializable;
import java.util.List;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

import com.honhattan.ejb.BookManagement;
import com.honhattan.entity.Book;

@Named
@RequestScoped
public class BookBean implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String name;
	private double price;
	
	@Inject
	private BookManagement bookManagement;
	
	public List<Book> getBooks(){
		return bookManagement.getBooks();
	}
	
	public void saveBook(){
		bookManagement.saveBook(new Book(name, price));
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
}
